]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Don't handle key events for insensitive source
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 25 Mar 2017 02:26:06 +0000 (03:26 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 4 Apr 2017 18:58:50 +0000 (20:58 +0200)
Generalizing menu toggling via keyboard in commit 1d58ea25ab6f047
fixed keynav in many places, but it turns out that it also adds
unexpected interactions in some cases where the source is not
button-like, as for example the entry context menus provided by
ShellEntry. Commit e33c68a415 fixed one case, however it is still
possible for plain enter/space to unexpectedly trigger the menu
if the entry itself doesn't consume the event, which is the case
when ClutterText:editable is false. However for a general fix, it
makes more sense to consider the source actor's :reactive property
and disable toggling menus via keyboard when they cannot be toggled
by pointer either - expecting non-editable entries to be non-reactive
as well seems like a reasonable assumption, and indeed all our code
follows that pattern.

https://bugzilla.gnome.org/show_bug.cgi?id=758873

js/ui/popupMenu.js

index 011a95ac051b8abe86cfc1ecd30994450532b337..d326ea83331343c7a1c3b14537ad6e3bc353c94b 100644 (file)
@@ -785,6 +785,11 @@ const PopupMenu = new Lang.Class({
     },
 
     _onKeyPress: function(actor, event) {
+        // Disable toggling the menu by keyboard
+        // when it cannot be toggled by pointer
+        if (!actor.reactive)
+            return Clutter.EVENT_PROPAGATE;
+
         let navKey;
         switch (this._boxPointer.arrowSide) {
             case St.Side.TOP: